clearvars -except Globaloption option

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This code reads in the VAR dynamics and produce the Campbell-Shiller decomposition in the paper
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Load data
loaddata_4CIjoint_annual_cy;

ttime = [1947:2020];

output_rp = 0.02 - mean(cy * .5); %risk premium 2
% %

%% Estimation
run ../../tools/cs_estimation.m

%% steady-state upper bound calculation
upper = exp(pxbar)*(mean(taxrevgdp-spendgdp));

save('MAT/CS_ConvYield_robust.mat','-regexp', '^(?!(option|Globaloption)$).');

%% bootstrap
run ../../tools/BS_compute.m

save 'MAT/Campbell_Shiller_CY_robust' ttime s gdebt upper std_coeff output_rp pdT pdG CFT CFG DR taxrevgdp spendgdp




